<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="mt-4 mb-4">
        <ul class="nav nav-tabs ">
            <li class="nav-item">
                <a class="nav-link active" aria-current="page" href="productList">商品管理</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="ingredientList">配料管理</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="orderList">订单管理</a>
            </li>
        </ul>
    </div>

    <div class="row">
        <div class="col-12">
            <article class="mb-4">
                <form class="form-inline" action="/productList" id="form1" method="post">
                    <div class="row">
                        <div class="col-md-3">
                            <input type="text" class="form-control" id="name" placeholder="请输入名称" th:value="${name}" name="name">
                        </div>
                        <div class="col-md-3">
                            <button type="submit" class="btn btn-primary">查询</button>

                            <a class="btn btn-primary btn-xs" th:href="@{/productCreate}">新增</a>
                        </div>
                    </div>
                </form>
            </article>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>名称</th>
                    <th>价格</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="item : ${list}">
                    <td th:text="${item.id}">1</td>
                    <td th:text="${item.name}">商品1</td>
                    <td th:text="${item.price}">100.00</td>
                    <td>
                        <a class="btn btn-primary btn-sm" th:href="@{/productUpdate(id=${item.id})}">编辑</a>
                        <a class="btn btn-danger btn-sm" th:href="@{/productRemove(id=${item.id})}">删除</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
</body>
</html>